package com.ruoyi.project.mesworkshop.service.impl;

import java.util.List;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.common.zx.PageData;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mesworkshop.mapper.MesWorkshopLineMapper;

/**
 * 车间流水线Service业务层处理
 *
 * @author zx
 * @date 2023-06-05
 */
@Service
public class MesWorkshopLineServiceImpl extends BaseController{
    @Autowired
    private MesWorkshopLineMapper mesWorkshopLineMapper;

    /**
     * 查询车间流水线
     *
     * @param workshop_code 车间流水线主键
     * @return pd
     */

    public PageData selectMesWorkshopLineByWorkshop_code(String workshop_code){
        return mesWorkshopLineMapper.selectMesWorkshopLineByWorkshop_code(workshop_code);
    }

    /**
     * 查询车间流水线列表
     *
     * @param pd
     * @return 车间流水线
     */

    public List<PageData> selectMesWorkshopLineList(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        return mesWorkshopLineMapper.selectMesWorkshopLineList(pd);
    }

    /**
     * 新增车间流水线
     *
     * @param pd 车间流水线
     * @return 结果
     */
    public int insertMesWorkshopLine(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        pd.put("create_by",this.getUsername());
        pd.put("create_time",DateUtils.getTime());
        return mesWorkshopLineMapper.insertMesWorkshopLine(pd);
    }

    /**
     * 修改车间流水线
     *
     * @param pd 车间流水线
     * @return 结果
     */
    public int updateMesWorkshopLine(PageData pd){
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        return mesWorkshopLineMapper.updateMesWorkshopLine(pd);
    }

    /**
     * 批量删除车间流水线
     *
     * @param workshop_codes 需要删除的车间流水线主键
     * @return 结果
     */
    public int deleteMesWorkshopLineByWorkshop_codes(String[] workshop_codes)
    {
        return mesWorkshopLineMapper.deleteMesWorkshopLineByWorkshop_codes(workshop_codes);
    }

    /**
     * 删除车间流水线信息
     *
     * @param workshop_code 车间流水线主键
     * @return 结果
     */
    public int deleteMesWorkshopLineByWorkshop_code(String workshop_code){
        return mesWorkshopLineMapper.deleteMesWorkshopLineByWorkshop_code(workshop_code);
    }
}
